"""
    用户登录
"""
import sys
from pathlib import Path

# 获取当前文件路径
current_path = Path(__file__)
# 获取当前文件所在目录
current_dir = current_path.parent
# 获取项目目录
project_dir = current_dir.parent.parent
# 将项目路径添加到sys.path
if str(project_dir) not in sys.path:
    sys.path.append(str(project_dir))
from commons import sessions

sessions = sessions.Session()


def login():
    resp = sessions.request(
        method="POST",
        url="https://beta-apis.wanxue.cn/auth/oauth/token",
        params={
            "grant_type": "password",
            "client_id": "qfRZaXirA7TeT8pb",
            "username": "15732069727",
            "password": "c51cd8e64b0aeb778364765013df9ebe"
        },
        headers={
            "a": "12",
            "forwardId": "70",
            "h": "wanxue",
            "p": "1",
            "u": "ffffffff-8d13-a56b-7169-0c980033c587",
            "v": "5020501"
        }
    )
    print(resp.json())
